home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / dos / exall.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-13  |  2.5 KB  |  107 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: exall.c,v 1.4 1996/09/13 17:50:06 digulla Exp $
  4.     $Log: exall.c,v $
  5.     Revision 1.4  1996/09/13 17:50:06  digulla
  6.     Use IPTR
  7.  
  8.     Revision 1.3  1996/08/13 13:52:45  digulla
  9.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  10.     Replaced __AROS_LA by __AROS_LHA
  11.  
  12.     Revision 1.2  1996/08/01 17:40:50  digulla
  13.     Added standard header for all files
  14.  
  15.     Desc:
  16.     Lang: english
  17. */
  18. #include <exec/memory.h>
  19. #include <clib/exec_protos.h>
  20. #include <dos/filesystem.h>
  21. #include <dos/exall.h>
  22. #include "dos_intern.h"
  23.  
  24. /*****************************************************************************
  25.  
  26.     NAME */
  27.     #include <clib/dos_protos.h>
  28.  
  29.     __AROS_LH5(BOOL, ExAll,
  30.  
  31. /*  SYNOPSIS */
  32.     __AROS_LHA(BPTR,                  lock,    D1),
  33.     __AROS_LHA(struct ExAllData *,    buffer,  D2),
  34.     __AROS_LHA(LONG,                  size,    D3),
  35.     __AROS_LHA(LONG,                  data,    D4),
  36.     __AROS_LHA(struct ExAllControl *, control, D5),
  37.  
  38. /*  LOCATION */
  39.     struct DosLibrary *, DOSBase, 72, Dos)
  40.  
  41. /*  FUNCTION
  42.  
  43.     INPUTS
  44.  
  45.     RESULT
  46.  
  47.     NOTES
  48.  
  49.     EXAMPLE
  50.  
  51.     BUGS
  52.  
  53.     SEE ALSO
  54.  
  55.     INTERNALS
  56.  
  57.     HISTORY
  58.     29-10-95    digulla automatically created from
  59.                 dos_lib.fd and clib/dos_protos.h
  60.  
  61. *****************************************************************************/
  62. {
  63.     __AROS_FUNC_INIT
  64.     __AROS_BASE_EXT_DECL(struct DosLibrary *,DOSBase)
  65.  
  66.     /* Get pointer to filehandle */
  67.     struct FileHandle *fh=(struct FileHandle *)BADDR(lock);
  68.  
  69.     /* Get pointer to process structure */
  70.     struct Process *me=(struct Process *)FindTask(NULL);
  71.  
  72.     /* Get pointer to I/O request. Use stackspace for now. */
  73.     struct IOFileSys io,*iofs=&io;
  74.  
  75.     /* Prepare I/O request. */
  76.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  77.     iofs->IOFS.io_Message.mn_ReplyPort     =&me->pr_MsgPort;
  78.     iofs->IOFS.io_Message.mn_Length     =sizeof(struct IOFileSys);
  79.     iofs->IOFS.io_Device =fh->fh_Device;
  80.     iofs->IOFS.io_Unit     =fh->fh_Unit;
  81.     iofs->IOFS.io_Command=FSA_EXAMINE_ALL;
  82.     iofs->IOFS.io_Flags  =0;
  83.     iofs->io_Args[0]=(IPTR)buffer;
  84.     iofs->io_Args[1]=size;
  85.     iofs->io_Args[2]=data;
  86.  
  87.     /* Send the request. */
  88.     DoIO(&iofs->IOFS);
  89.  
  90.     /* Set error code and return */
  91.     if((me->pr_Result2=iofs->io_DosError)!=0)
  92.     {
  93.     control->eac_Entries=0;
  94.     return 0;
  95.     }
  96.  
  97.     for(size=1;buffer!=NULL;size++)
  98.     {
  99.     buffer->ed_Prot^=0xf;
  100.     buffer=buffer->ed_Next;
  101.     }
  102.     control->eac_Entries=size;
  103.  
  104.     return 1;
  105.     __AROS_FUNC_EXIT
  106. } /* ExAll */
  107.